<template>
	<view>
		<view class="al-list">
			<view class="al-items">
				<view v-for="(items, index) in currentuser" :key="index">
					<view class="al-items-1">
						<view><image class="img" :src="items.avatarUrl" mode=""></image></view>
						<view class="name">{{ items.nickname }}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
import { search_list, search_list_all } from '@/network/https/search.js';
export default {
	props:["username"],
	data() {
		return {
			currentuser: '',
			totalPage: 1, //有几页
			pageSize: 30, //每页几条
			currentPage: 1 //当前页数
		};
	},
	onReachBottom() {
		this.user();
	},
	onLoad(val) {
	},
	created() {
		this.user();
	},
	methods: {
		async user() {
			const parm = {
				keywords: this.username,
				limit: this.pageSize,
				offset: this.currentPage,
				type: 1002
			};
			const { data: res } = await search_list_all(parm.keywords, parm.limit, parm.offset, parm.type);
			this.currentPage += 10;
			this.totalPage = res.result.userprofileCount;
			this.currentuser = [...this.currentuser, ...res.result.userprofiles];
			console.log('user', res);
		}
	}
};
</script>

<style lang="scss" scoped>
.al-list {
	background-color: #ffffff;
	width: 700rpx;
	box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
	margin: 30rpx auto;
	border-radius: 10rpx;
	padding-bottom: 30rpx;
	.al-items {
		&-1 {
			display: flex;
			align-items: center;
			margin-left: 20rpx;
			padding-top: 20rpx;
			.img {
				width: 130rpx;
				height: 130rpx;
				border-radius: 50%;
			}
			.name {
				margin-left: 30rpx;
			}
		}
	}
}
</style>
